package interview.javabase.thread.runnable;

/**
 * @author 大硕
 * 2019-03-28 9:54 PM
 **/
public class CycleWait implements Runnable {

    private String value;

    @Override
    public void run() {
        try {
            Thread.currentThread().sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        value = "wxz 1";
    }

    public static void main(String[] args) throws Exception {
        CycleWait cw = new CycleWait();
        Thread t = new Thread(cw);
        t.start();
//        while (cw.value==null) {
//            Thread.sleep(1000);
//            System.out.println("value: " + cw.value);
//        }
        t.join();
        System.out.println("value: " + cw.value);
    }
}